package struts.ext.util;

import java.util.List;
import java.util.Map;

public class ExcelReturnWrapper {
	
	public static final int MAX_COUNT_IN_A_SHEET = 60000; //每个sheet最多记录数
	
	/**
	 * 要转换为excel的数据
	 */
	private List<?> list; 
	/**
	 * sheet名
	 */
	private String sheetName; 
	/**
	 * 一个sheet最多有多少条记录，超过此记录将另起一个sheet。
	 */
	private int maxCountInASheet = MAX_COUNT_IN_A_SHEET;
	
	/**
	 * javabean的属性名和Excel中对应的表头的映射关系
	 */
	private Map<String,String> attLabels;//
	
	public ExcelReturnWrapper(List<?>  list, Map<String, String> attLabels, String sheetName) {
		super();
		this.list = list;
		this.attLabels = attLabels;
		this.sheetName = sheetName;
	}
	public ExcelReturnWrapper(List<?>  list, Map<String, String> attLabels, 
			String sheetName, int maxCountInASheet) {
		super();
		this.list = list;
		this.attLabels = attLabels;
		this.sheetName = sheetName;
		this.maxCountInASheet = maxCountInASheet > MAX_COUNT_IN_A_SHEET ? 
								MAX_COUNT_IN_A_SHEET : maxCountInASheet;
	}
	
	public List<?>  getList () {
		return list;
	}
	
	public void setList (List<?>  list) {
		this.list = list;
	}
	
	public Map<String, String> getAttLabels() {
		return attLabels;
	}
	public void setAttLabels(Map<String, String> attLabels) {
		this.attLabels = attLabels;
	}

	public String getSheetName() {
		return sheetName;
	}

	public void setSheetName(String sheetName) {
		this.sheetName = sheetName;
	}
	public int getMaxCountInASheet() {
		return maxCountInASheet;
	}
	public void setMaxCountInASheet(int maxCountInASheet) {
		this.maxCountInASheet = maxCountInASheet;
	}
	
}
